USE [LAFDC]
GO
/****** Object:  StoredProcedure [dbo].[spGetETAT_CIVILE_byPrevID]    Script Date: 11/23/2009 23:01:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Ludovic FERRE
-- Create date: 2007-08-30
-- Description:	SP to retrieve ETAT_CIVILE by prev_id
-- =============================================

-- UPDATED TO HANDLE PERSONNE TABLE

CREATE PROCEDURE [dbo].[spGetETAT_CIVILE_byPrevID]
	-- Add the parameters for the stored procedure here
	@PREV_ID nvarchar(255)
AS
BEGIN
	SET NOCOUNT ON;

		SELECT 
				adh.prev_id,
				p.nom,
				p.prenom,
				p.[civ-sexe],
				p.sfam,
				p.Anniv
		  FROM adherent adh
		  JOIN [personne] p
			ON adh.prev_id = p.prev_id
		 WHERE adh.prev_id =  @PREV_ID and sfam != 'enfant' and sfam != 'conjoint(e)'

END